package com.zxy.utils;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class JSONUtil {
    
    public static String getJSONData(HttpServletRequest request) throws IOException {
        //用流接收json数据
        InputStream inputStream = request.getInputStream();
        BufferedReader br=new BufferedReader(new InputStreamReader(inputStream,"UTF-8"));
        String s;
        StringBuilder sb=new StringBuilder();
        while ((s=br.readLine())!=null){
            sb.append(s);
        }
        return sb.toString();
    }
}
